package com.perfma.xtest.tool.word;

/**
 *
 */
public enum MonEntityType implements BaseCodeEnum {

    APP("应用", 1, "APP"),
    CLUSTER("集群", 2, "CLUSTER"),
    MACHINE("机器", 3, "MACHINE"),
    PROCESS("进程", 4, "PROCESS"),
    BIZ("业务", 5, "BIZ");

    private String name;
    private Integer code;
    private String value;

    MonEntityType(String name, int index, String value) {
        this.name = name;
        this.code = index;
        this.value = value;
    }

    public String getName() {
        return name;
    }


    public String getValue()
    {
        return value;
    }

    /**
     * 根据type获取枚举
     *
     * @param code type索引值
     */
    public static MonEntityType getCode(Integer code) {
        for (MonEntityType execType : MonEntityType.values()) {
            if (execType.getCode().equals(code)) {
                return execType;
            }
        }
        return null;
    }

    @Override
    public Integer getCode() {
        return code;
    }
}
